<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of CWidgets
 *
 * @author andrea
 */
class CWidgets_vidwiz extends Controller_vidwiz{
    
    public function get_vidwiz_searchbox(){
        $debug = USingleton_vidwiz::getInstances("UDebug_vidwiz");
        $CVideos = USingleton_vidwiz::getInstances("CVideos_vidwiz");
        $VWidget = USingleton_vidwiz::getInstances("VWidgets_vidwiz");
        $lastVideos = $CVideos->getLastVideos(15);
        foreach ($lastVideos as $key => $value){
            $lastVideos[$key] = $CVideos->absPathInArray($value,array('file_position','thumb'));
            }
        $searchbox = $VWidget->get_searchbox($lastVideos);
        
        return $searchbox;
        
    }
    
    public function get_vidwiz_contests_wid(){
        $debug = USingleton_vidwiz::getInstances("UDebug_vidwiz");
        $CCont = USingleton_vidwiz::getInstances("CContests_vidwiz");
        $VWidget = USingleton_vidwiz::getInstances("VWidgets_vidwiz");
        $MWidget = USingleton_vidwiz::getInstances("MWidgets_vidwiz");
        $activeContests = $CCont->getContestsSubscription();
        
        if($activeContests != false)
            foreach($activeContests as $key => $value){
                $activeContests[$key]['startDate'] = $MWidget->dateToEng($value['startDate']);
                $activeContests[$key]['stopDate'] = $MWidget->dateToEng($value['stopDate']);
            }
        return $VWidget->getContestsWid($activeContests);
    }
}

?>
